package com.jy.servlet;

import com.alibaba.fastjson.JSON;
import com.jy.bean.User;
import com.jy.service.UserService;
import com.jy.service.impl.UserServicelmpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class merchant_update_userServlet extends HttpServlet {
    private static final Logger log = LoggerFactory.getLogger(merchant_select_userServlet.class);
    private static UserService userService;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String user_name = request.getParameter("user_name");
        String user_Email = request.getParameter("user_Email");
        String user_Address = request.getParameter("user_Address");
        String user_ConsigneeName = request.getParameter("user_ConsigneeName");
        String user_Datetime = request.getParameter("user_Datetime");

        userService = new UserServicelmpl();
        boolean favg = userService.update_user(new User(null,user_name,null,user_Email,user_Address,user_ConsigneeName,null,user_Datetime));

        String data = JSON.toJSONString(favg);

        response.setContentType("application/json");
        response.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();
        out.println(data);
        log.debug("data:" +data);
    }
}
